<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <ul></ul>
    <script>
        let arr = ['apple','banana','orange','pear'];

        // let arr2 = arr.map(item=>{
        //     console.log(item);
        //     // return `水果:${item}`;
        //     return `<li>${item}</li>`;
        // });

        // let str = arr2.join('');
        // console.log(arr2);
        // console.log(str);

        // let str = arr.map(item=>`<li>${item}</li>`).join('');
        // document.querySelector('ul').innerHTML = str;

        // find - 找到对象中符合条件的那个值
        // let obj = arr.find(item=>{
        //     console.log(item);
        //     // 返回值 只有真和假
        //     return item === 'banana';
        // })

        let obj = arr.find(item=> item === 'banana2')

        console.log(obj);




    </script>
</body>
</html>